/*
 * Solution.h
 *
 *  Created on: Sep 19, 2012
 *      Author: pedro
 */

#ifndef SOLUTION_H_
#define SOLUTION_H_

#include <iostream>
#include <vector>

#include<mpi.h>

#include "Defines.h"
#include "Index.h"
#include "Graph.h"
#include "Problem.h"


#define NOT_FOUND 0
#define FOUND 1

using namespace std;
using namespace MPI;

class Solution {

public:

	Solution();

	Solution(vector<int> &);

	virtual ~Solution();

	vector<int> getAnswer();

	bool isGood();

	int getNCycles();

	Index getCycleEdge(Problem &, int *);

	void printSolution();

	void calculateCost(Graph &);

	int getCost();

	bool hasCost();

	void build(vector<int> &);





private:

	void processCycles();

	int nCycles;
	vector<int> answer;
	vector<vector<int > > cycles;
	int cost;

	Request received;
	int *solution;
};


#endif /* SOLUTION_H_ */
